<?php
	require_once('auth.php');

?>

<html>
<head>
<script language="javascript">
location.replace("Form_Member.php")

</script>
<title>::.::.::  APPMA  ||  Member Update  ::.::.::</title></head>
<body>
<?php
$con = mysql_connect("localhost","appma" ,"database");
		
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

	mysql_select_db("162_appma", $con);
	$oldregno=$_POST['oldregno'];
	
$update = mysql_query("DELETE FROM members WHERE regno = '$oldregno'");
	
	
$sql="INSERT INTO  members (
`regno` ,
`name` ,
`status` ,
`cnic` ,
`firmname` ,
`established` ,
`headoffice` ,
`phno` ,
`fax` ,
`mobile` ,
`phres` ,
`email` ,
`catagory` ,
`ntn` ,
`streg` ,
`voter`
)
VALUES
(
'$_POST[regno]',
'$_POST[name]',
'$_POST[status]',
'$_POST[cnic]',
'$_POST[firmname]',
'$_POST[established]',
'$_POST[headoffice]',
'$_POST[phno]',
'$_POST[fax]',
'$_POST[mobile]',
'$_POST[phres]',
'$_POST[email]',
'$_POST[catogary]',
'$_POST[ntn]',
'$_POST[streg]',
'$_POST[voter]'
)";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
	
/*$sql="UPDATE member 
SET 
regno = '$_POST[regno]',
name = '$_POST[name]',
status = '$_POST[status]',
cnic = '$_POST[cnic]',
firmname = '$_POST[firmname]',
established = '$_POST[established]',
headoffice = '$_POST[headoffice]',
phno = '$_POST[phno]',
fax = '$_POST[fax]',
mobile = '$_POST[mobile]',
phres = '$_POST[phres]',
email = '$_POST[email]',
catagory = '$_POST[catagory]',
ntn = '$_POST[ntn]',
streg = '$_POST[streg]',
voter = '$_POST[voter]'
WHERE regno = '$_POST[oldregno]'
";
*/

echo "1 record Updated";
mysql_close($con)

?>
		 
		 
</body>
  </html>                    
                 

